<template>
  <div class="rotation_div" v-if="banner_data">
    <!-- 轮播 -->
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="(item,index) of banner_data" :key="index">
        <img class="banner_img" :src="getImgPath + item.img_path" @click="banner_img_click(item.link_url)">
      </van-swipe-item>
  </van-swipe>
  </div>
</template>
<script>
import {mapGetters} from "vuex";
export default {
  name:"Rotation",
  props:["banner_data"],
  methods: {
    // banner 点击事件
    banner_img_click(link_url){
      if(!link_url){// 如果 link_url 为空 则 return
        return;
      }
      // 否则 转跳
      this.$router.push(link_url)
      // console.log(link_url);
    }
  },
  computed: {
    ...mapGetters("ImgPath",{
      getImgPath:"getImgPath"
    })
  },
}
</script>
<style lang="less" scoped>
  .rotation_div{
    height: 0rem;
    overflow: hidden;
    padding-bottom: 1.80rem;
    .banner_img{
      width: 100%;
    }
  }
  .my-swipe {
    height: 1.80rem;
  }
 .my-swipe .van-swipe-item{
    height: 1.80rem;
    background-color: #999;
    text-align: center;
    overflow: hidden;
  }
</style>